<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>管理员登录 - BsAdmin后台模板</title>
    <link rel="icon" href="./static/favicon.ico">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/css/login.css">
    <script src="${pageContext.request.contextPath}/static/js/vue.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.bundle.js"></script>
</head>
<body>
<div class="login">
    <form method="post" action="${pageContext.request.contextPath}/LoginServlet">
        <h2>BsAdmin后台模板</h2>
        <div class="form-group">
            <label>用户名(t350)</label>
            <input type="text" name="name" class="form-control form-control-lg">
        </div>
        <div class="form-group">
            <label>密码(123)</label>
            <input type="password" name="pwd" class="form-control form-control-lg" id="pwd">
        </div>
        <div class="form-group">
            <label>验证码</label>
            <input type="text" name="code" id="checkcode" class="form-control form-control-lg">
            <img src="${pageContext.request.contextPath}/ImageServlet" onclick="reload()" alt="验证码" id="image"/>
        </div>
        <div class="form-group form-check">
            <input type="checkbox" class="form-check-input" id="exampleCheck1">
            <label class="form-check-label" for="exampleCheck1">记住密码</label>
        </div>

        <button type="submit" :disabled="loading" @click="login" class="btn btn-primary btn-lg  btn-block">
            <span v-show="loading" class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
            立即登录
        </button>
    </form>
</div>
</body>
<script>
    //获得项目根目录
    var path = location.pathname;
    path = path.substr(0, path.substr(1).indexOf("/") + 1)
    function reload() {
        document.getElementById("image").src = path + "/ImageServlet?date=" + new Date().getTime();
        //$("#checkcode").val(""); // 将验证码清空
    }
</script>
</html>
